package com.zqxq.lottery.api.controller;


import com.zqxq.common.constant.Result;
import com.zqxq.common.utils.DispatcherUtils;
import com.zqxq.lottery.api.feign.LotteryServerFeignClient;
import com.zqxq.lottery.entity.bo.jczq.JczqWorldCupBO;
import com.zqxq.lottery.entity.bo.jczq.MatchApiBO;
import com.zqxq.lottery.entity.vo.jczq.*;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 说    明：   竞猜足球 API
 * 创 建 人：	一刀·胡
 * 创建时间：	2018/5/8 19:19
 * 修 改 人：
 * 修改日期：
 **/
@Api(value = "竞猜赛事接口",tags = "竞猜赛事接口")
@Slf4j
@RestController
@RequestMapping(value="/jczq",produces = "application/json")
public class JczqController {

    @Autowired
    private LotteryServerFeignClient lotteryServerFeignClient;

    @PostMapping("/match/hot/list")
    @ApiOperation(value = "热门赛事", notes = "热门赛事")
    public Result<List<MatchApiVO>> hotMatchList(MatchApiBO search){
        //TODO 热门赛事
        return lotteryServerFeignClient.hotMatchList(search);
    }
    @PostMapping("/league/hot/list")
    @ApiOperation(value = "热门联赛", notes = "热门联赛")
    public Result<List<LeagueApiVO>> hotLeagueList(){
        //TODO 热门联赛
        return lotteryServerFeignClient.hotLeagueList();
    }
    @PostMapping("/match/result/list")
    @ApiOperation(value = "历史开奖信息、比分直播", notes = "历史开奖信息")
    public Result matchResultList(String startTime,
                                  String endTime,
                                  @ApiParam(value = "页码",required = true) @RequestParam(defaultValue = "1") String pageNo,
                                  @ApiParam(value = "每页大小",required = true) @RequestParam(defaultValue = "10") String pageSize,
                                  @ApiParam(value = "赛事状态 1：即时（当日比赛）2：完场 3：赛程（次日及之后赛事）",required = false) @RequestParam(defaultValue = "1") Integer status,
                                  @ApiParam(value = "联赛 0:全部 1:竞猜 2:中超 3:欧冠 4:英超 5:德甲 6:西甲 7:意甲 8:法甲",required = false) @RequestParam(defaultValue = "0") Integer type,
                                  @ApiParam(value = "赛事类型 0:足球 1:篮球",required = false) @RequestParam(defaultValue = "0") Integer matchType){
        Map<String,Object> paramMap = new HashMap();
        paramMap.put("pageNo",pageNo);
        paramMap.put("pageSize",pageSize);
        paramMap.put("startTime",startTime);
        paramMap.put("endTime",endTime);
        paramMap.put("status",status);
        paramMap.put("type",type);
        paramMap.put("matchType",matchType);
        return lotteryServerFeignClient.matchResultList(paramMap);
    }

    @PostMapping("/world/cup/list")
    @ApiOperation(value = "世界杯-球队列表", notes = "世界杯-球队列表")
    public Result<List<JczqWorldCupVO>> queryWorldCupList(String year){
        JczqWorldCupBO search = new JczqWorldCupBO();
        search.setPeriod(year);
        return lotteryServerFeignClient.queryWorldCupList(search);
    }

    @PostMapping("/world/queryAgainstPlanUrl")
    @ApiOperation(value = "获取对阵图片地址", notes = "获取对阵图片地址")
    public Result queryAgainstPlanUrl(){
        return lotteryServerFeignClient.queryAgainstPlanUrl();
    }

    @PostMapping("/user/grand")
    @ApiOperation(value = "竞猜足球战绩榜", notes = "竞猜足球战绩榜")
    public Result<JczqGrandVO> queryUserGrand(Long userId){
        return lotteryServerFeignClient.queryUserGrand(userId);
    }

}
